/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.d2g.openrealestate.persistence;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author d2g
 */
@Entity
@Table(name = "garden", catalog = "dd111", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Garden.findAll", query = "SELECT g FROM Garden g"),
    @NamedQuery(name = "Garden.findByIdGarden", query = "SELECT g FROM Garden g WHERE g.idGarden = :idGarden"),
    @NamedQuery(name = "Garden.findByType", query = "SELECT g FROM Garden g WHERE g.type = :type")})
public class Garden implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_garden", nullable = false)
    private Integer idGarden;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "type", nullable = false, length = 45)
    private String type;

    public Garden() {
    }

    public Garden(Integer idGarden) {
        this.idGarden = idGarden;
    }

    public Garden(Integer idGarden, String type) {
        this.idGarden = idGarden;
        this.type = type;
    }

    public Integer getIdGarden() {
        return idGarden;
    }

    public void setIdGarden(Integer idGarden) {
        this.idGarden = idGarden;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idGarden != null ? idGarden.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Garden)) {
            return false;
        }
        Garden other = (Garden) object;
        if ((this.idGarden == null && other.idGarden != null) || (this.idGarden != null && !this.idGarden.equals(other.idGarden))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.d2g.openrealestate.persistence.Garden[ idGarden=" + idGarden + " ]";
    }
    
}
